<template>
	<view class="page">
		<view class="topVue">
			<view class="safeVue" :style="{ height: statusBarHeight + 'rpx' }"></view>
			<view class="flex align-center padding-row30" :style="{ height: barHeight + 'rpx', top: statusBarHeight + 'rpx' }" @click="$tools.back()">
				<image src="../../static/back.png" style="width: 48rpx; height: 48rpx;"></image>
				<text style="line-height: 1; color: #454545; font-weight: 600; font-size: 32rpx; padding-left: 20rpx;">消费合伙人</text>
			</view>
		</view>
		<view :style="{ height: statusBarHeight + barHeight + 'rpx' }"></view>
		<view class="banner"></view>
		
		<view class="item margin20 flex" @click="goDetail()">
			<image :src="obj.url" style="width: 240rpx; height: 240rpx; border-radius: 20rpx 0 0 20rpx;"></image>
			<view class="right flex-between flex-column">
				<view class="name">{{obj.name}}</view>
				<view class="remark">{{obj.description}}</view>
				<view class="price">￥{{obj.price}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				statusBarHeight: 0,
				barHeight: 0,
				obj: {}
			}
		},
		onLoad() {
			let that = this;
			wx.getSystemInfo({
				success(res) {
					let deviceWidth = wx.getSystemInfoSync().windowWidth
					that.statusBarHeight = Number(res.statusBarHeight) * ( 750 / deviceWidth ) 
					let menuButtonInfo = wx.getMenuButtonBoundingClientRect()
					let barHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2
					that.barHeight = Number(barHeight) * ( 750 / deviceWidth )
				},
			});
		},
		
		async onShow() {
			await this.getList()
		},
		
		methods: {
			async getList(){
				const res = await this.$request("/api/WeChat/goodList", {}, "GET")
				if(res.code===200) {
					this.obj = res.data
					console.log(this.obj)
				}
			},
			
			goDetail(){
				uni.navigateTo({
					url: "./hehuorenDetail?item=" + encodeURIComponent(JSON.stringify(this.obj))
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.topVue {
		width: 100%;
		background: #fff;
		position: fixed;
		left: 0;
		top: 0;
		z-index: 99;
		.safeVue {
			width: 100%;
		}
	}
	.banner {
		width: 100%;
		height: 500rpx;
		background: #f5f5f5;
	}
	.item {
		width: 690rpx;
		height: 240rpx;
		background: #fff;
		border-radius: 20rpx;
		box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(178, 178, 178, 0.25), inset 0rpx 8rpx 8rpx 0rpx rgba(255, 255, 255, 0.25);
		.right {
			flex: 1;
			height: 240rpx;
			padding: 20rpx;
			.name {
				line-height: 1;
				font-weight: 600;
				color: #333;
			}
			.remark {
				color: #666;
			}
			.price {
				color: #D37430;
				line-height: 1;
				font-size: 30rpx;
				font-weight: 600;
			}
		}
	}
</style>